#!/usr/bin/env ruby
require "fileutils"
include FileUtils

config_file = File.join(File.dirname(__FILE__), "monit.127.0.0.1.config")
config_file_template = "#{config_file}.template"

template = File.open(config_file_template){|f| f.read}
include_instruction = "include #{File.expand_path(File.dirname(__FILE__))}/sites/*/config/monit.127.0.0.1.*.config"
File.open(config_file, "w+"){|f| f.write template + "\n" + include_instruction}
chmod 0700, config_file